package com.ruoyi.common.exception

/**
 * 全局异常
 *
 * @author ruoyi
 */
class GlobalException : RuntimeException {
    /**
     * 错误提示
     */
    override var message: String? = null
        private set

    /**
     * 错误明细，内部调试错误
     *
     * 和 CommonResult.getDetailMessage 一致的设计
     */
    private var detailMessage: String? = null

    /**
     * 空构造方法，避免反序列化问题
     */
    constructor()
    constructor(message: String?) {
        this.message = message
    }

    fun setDetailMessage(detailMessage: String?): GlobalException {
        this.detailMessage = detailMessage
        return this
    }

    fun setMessage(message: String?): GlobalException {
        this.message = message
        return this
    }

    companion object {
        private const val serialVersionUID = 1L
    }
}
